package com.example.fw;

import java.util.List;

import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.ui.Select;

public class HelperWithWebDriverBase {
	
	protected ApplicationManager manager;
	private WebDriver driver;
 

	public HelperWithWebDriverBase (ApplicationManager manager) {
		this.manager = manager;
		driver=manager.getWebDriverHelper().getDriver();		
	}
	
	
	protected void type(By locator, String text) {
		findElement(locator).clear();
		findElement(locator).sendKeys(text);
		//By.name(locator)
	}
	
	protected void selectFromList(By locator, String value) {
			new Select(findElement(locator)).selectByVisibleText(value);
	}


	protected WebElement findElement(By locator) {
		return driver.findElement(locator);
	}
	
	protected List<WebElement> findElements(By locator) {
		return driver.findElements(locator);
	}


	protected void openUrl(String url) {
		driver.get(url);
	}


	protected void click(By locator) {
		findElement(locator).click();
	}

}
